/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package validation;

import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Daniel
 */
public class ValidatorManager {
    
    protected List<Validator> validators = new ArrayList<Validator>();
    
    public void addValidator(Validator validator)
    {
        validators.add(validator);
    }
    
    public List<String> validateAll()
    {
        List<String> errors = new ArrayList<String>(); 
        for (Validator  validator   : validators) {//ITERATOR
            if (!validator.validate())
                errors.add(validator.getError());
        }
        return errors;
    }
        
    
    
}
